<include file="Public/header" />
<include file="Public/menu" />
<link rel="stylesheet" href="/Public/admin/adminlte/bootstrap/css/bootstrap-switch.min.css">
<!-- 内容页 -->
<div class="content-wrapper">
    <!-- 面包屑 -->
    <section class="content-header">
        <h1>
            分销
            <small>管理</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 分销管理</a></li>
            <li class="active">奖金配置</li>
        </ol>
    </section>

    <!-- 内容 -->
    <section class="content"><div class="row"><div class="col-md-12">
        <div class="box box-info">
            <div class="box-header with-border">
                <h3 class="box-title"></h3>

                <div class="box-tools">

                    <div class="btn-group pull-right" style="margin-right: 10px">

                    </div>
                </div>
            </div>
            <!-- /.box-header -->
            <!-- form start -->
            <form action="{:U('Qgs/Distribution/setMoney')}" method="post" class="form-horizontal" id="form">
                <div class="box-body">
                    <div class="form-group 1">
                        <label class="col-sm-2 control-label">是否开启</label>
                        <div class="col-sm-6">
                            <div class="input-group switch">
                                <input type="checkbox" name="state" data-size="mini" data-id="{$v.tmp_id}" data-on-text="启用" data-off-text="禁用" <if condition="$is_open_distribution eq '1' ">checked</if>>
                            </div>
                        </div>
                    </div>
                    <div class="form-group 1">
                        <label class="col-sm-2 control-label">朋友关注公众号奖励</label>
                        <div class="col-sm-6">
                            <div class="input-group">
                                <span class="input-group-addon"><i class="fa fa-pencil"></i></span>
                                <input type="text" name="follow_wechat" value="{$follow_wechat}" class="form-control" placeholder="朋友关注公众号奖励">
                                <span class="input-group-addon"><i class="fa">元</i></span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group 1">
                        <label class="col-sm-2 control-label">下属生成海报奖励</label>
                        <div class="col-sm-6">
                            <div class="input-group">
                                <span class="input-group-addon"><i class="fa fa-pencil"></i></span>
                                <input type="text" name="generate_poster" value="{$generate_poster}" class="form-control" placeholder="下属生成海报奖励">
                                <span class="input-group-addon"><i class="fa">元</i></span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group 1">
                        <label class="col-sm-2 control-label">下属购物提成奖励</label>
                        <div class="col-sm-6">
                            <div class="input-group">
                                <span class="input-group-addon"><i class="fa fa-pencil"></i></span>
                                <input type="text" name="son_shopping" value="{$son_shopping}" class="form-control" placeholder="下属购物提成奖励">
                                <span class="input-group-addon"><i class="fa">%</i></span>
                            </div>
                        </div>
                    </div>

                </div>
                <!-- /.box-body -->
                <div class="box-footer">
                    <div class="col-sm-2">

                    </div>
                    <div class="col-sm-6">

                        <div class="btn-group pull-left">
                            <button type="submit" class="btn btn-info pull-right">保存</button>
                        </div>

                    </div>

                </div>
                <!-- /.box-footer -->
            </form>
        </div>

    </div></div>

    </section>
</div>
<!-- 底部 -->
<include file="Public/common_footer" />
<script src="__PUBLIC__/admin/adminlte/bootstrap/js/bootstrap-switch.min.js"></script>
<script data-exec-on-popstate>


    $(function(argument) {
        $('.switch [type="checkbox"]').bootstrapSwitch();

        $('input[name="state"]').on('switchChange.bootstrapSwitch', function (event, state) {
            //return $("input[name=state]").bootstrapSwitch('state', false);return false;
            var tmp_id = $(this).data('id');
            var _tr = $(this).parents('tr');
            var others = _tr.siblings().find('input[name=state]');
            //console.log(others);return false;
            $.ajax({
                type: 'get',
                url: "{:U('Qgs/Distribution/isOpen')}",
                data: {state: state},
                success: function (msg) {
                    alert(msg == 1 ? '成功' : '失败');
                }
            })
        });
    });
</script>

